<%@ page contentType="text/html;charset=UTF-8"%>
<%@ include file="/common/taglibs.jsp"%>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta name="nav" content="0" />
<meta name="acc" content="1-0-2" />
<title>发文登记</title>
<script type="text/javascript">
	var i = 1;
	function addFile(divName, fileName) {
		var dv = document.getElementById(divName);

		var file = document.createElement("input");
		file.type = "file";
		file.name = fileName;
		file.id = fileName + i;
		dv.appendChild(file);

		var btn = document.createElement("input");
		btn.type = "button";
		btn.id = btn.name = "btn" + i;
		btn.value = "删除";

		btn.onclick = function() {
			var b = document.getElementById(btn.id);
			dv.removeChild(b.nextSibling);
			dv.removeChild(b.previousSibling);
			dv.removeChild(b);
		}

		dv.appendChild(btn);
		dv.appendChild(document.createElement("BR"));

		i++;
	}

	$(document).ready(
			function() {
				var date = new Date();
				$.get(
						"${ctx}/business/history/history!info.action?key=${id}&time="
								+ date, function(data) {
							$("#frame").html(data);
						});
			});
</script>
</head>
<body>
	<form action="${ctx }/admin/convey!save2.action" method="post"
		id="inputForm" class="yform" enctype="multipart/form-data">
		<div id="caption">
			<h6>${licenseplateNumber}拟办文件</h6>
		</div>
		<input type="hidden" name="id" id="id" value="${id }"> <input
			type="hidden" name="taskId" id="taskId" value="${taskId }"> <input
			type="hidden" name="sentOrgName" id="sentOrgName" value="东莞质量检测站">
		<div>
			<table class="noborder">
				<tr class="type-text">
					<td>发文标题</td>
					<td colspan="3"><input type="text" name="title"
						value="${title }" /></td>
				</tr>
				<tr class="type-text">
					<td>发文字号</td>
					<td><input type="text" name="num" value="${num }" />
					</td>
					<td>公文类型</td>
					<td><input type="text" name="type" value="${type }">
					</td>
				</tr>
				<tr class="type-text">
					<td>紧急程度</td>
					<td><pt:code category="3053" name="crash" default="${crash }"></pt:code>
					</td>
					<td>密集程度</td>
					<td><pt:code category="3054" name="secret"
							default="${secret }"></pt:code>
					</td>
				</tr>
				<tr class="type-text">
					<td>主送单位</td>
					<td colspan="3"><input type="text" name="takeOrgName"
						value="${takeOrgName }" />
					</td>
				</tr>
				<tr class="type-text">
					<td>抄送单位</td>
					<td colspan="3"><input type="text" name="copyOrgName"
						value="${copyOrgName }" />
					</td>
				</tr>
				<tr class="type-text">
					<td>主题词</td>
					<td colspan="3"><input type="text" name="keywords"
						value="${keywords }" /></td>
				</tr>
				<tr class="type-text">
					<td>公文来源</td>
					<td colspan="3"><input type="text" name="source"
						value="${source }" /></td>
				</tr>
				<tr class="type-text">
					<td>内容简介</td>
					<td colspan="3"><textarea name="content">${content }</textarea>
					</td>
				</tr>
				<tr class="type-text">
					<td>备注</td>
					<td colspan="3"><textarea id="remark" name="remark">${remark }</textarea>
					</td>
				</tr>
				<tr class="type-text">
					<td><input type="button" value="添加单个文件"
						onclick="addFile('sources','upload')" class="type-button">
					</td>
					<td colspan="3" id="sources"></td>
				</tr>
			</table>
			<c:if test="${not empty attachmentSet }">
				<div id="caption">
					<h6>${licenseplateNumber}已有附件</h6>
				</div>
				<table>
					<c:forEach items="${attachmentSet }" var="attachment">
						<tr>
							<td colspan="4"><a title="下载"
								href="${ctx}/servlet/annex?id=${attachment.id}">${attachment.upfileFileName}(${attachment.type})<fmt:formatDate
										value="${attachment.fileTime}" pattern="yyyy-MM-dd" /> </a></td>
						</tr>
					</c:forEach>
				</table>
			</c:if>
		</div>
		<div id="caption">
			<h6>${licenseplateNumber}历史记录</h6>
		</div>
		<div id="frame"></div>
		<div class="type-button">
			<input class="button" type="submit" class="submit" value="提交"
				onclick="return isProcess();" />&nbsp; <input class="reset"
				type="button" value="返回" class="rest" onclick="history.back()" />
		</div>
	</form>
</body>
</html>